package com.seer.auto.entity;

import com.seer.auto.utils.ClassUtils;
import com.seer.auto.utils.SqlUtils;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class Column {
    private String name;
    private String dataType;
    private String extra;
    private String javaName;
    private String getMethod;
    private String setMethod;
    private String javaType;


    public String getJavaName() {
        if (null == javaName) {
            javaName = ClassUtils.lowerFirstCase(ClassUtils.className(name));
        }
        return javaName;
    }

    public String getMethod() {
        if (null == getMethod) {
            getMethod = "get" + ClassUtils.className(name);
        }
        return getMethod;
    }

    public String setMethod() {
        if (null == setMethod) {
            setMethod = "set" + ClassUtils.className(name);
        }
        return setMethod;
    }

    public String getJavaType() {
        if (null == javaType) {
            javaType = SqlUtils.getJavaType(dataType);
        }
        return javaType;
    }

}
